<?php

namespace App\Model;

use Illuminate\Database\Eloquent\Model;

class Stop_settle extends Model
{
    //
	protected $table='stop_settle';
	protected $guarded=[];
//	protected $fillable=['staff_id','staff_task_id','termination','is_agree'];
	protected $hidden=[];

	public function stop_list($store_id){
		$data=$this->where(['store_id'=>$store_id])->with(['staff_task'=>function($query){
			$query->with('store_station')->with('task');
		}])->with('staff_info')->get();
		return $data;
	}

	public function staff_info(){
		return $this->belongsTo('App\Model\Staff','staff_id');
	}


	public function store_station(){
		return $this->belongsTo('App\Model\Store_station','store_station');
	}


	public function staff_task(){
		return $this->belongsTo('App\Model\Staff_task','staff_task_id');
	}


//	查询所有的结算列表
	public function lists($where){
		$data=$this->where(['uid'=>$where['uid']])->
		whereBetween('created_at',[$where['start_time'],$where['end_time']])
			->with(['staff_task'=>function($query){
			$query->with('task');
		}])
			->get();
		return $data;
	}
//	查询结算工单详情
	public function desc($id){
		$data=$this->where(['id'=>$id])->first();
		return $data;
	}




}
